/*
 * @Author: lbt666 '1319451895@qq.com'
 * @Date: 2022-07-26 14:44:46
 * @LastEditors: lbt666 lbt666@@
 * @LastEditTime: 2023-07-05 21:34:35
 * @Description: Api
 */
import { Service } from "./service"
import type { configData } from './asioxType'

// 地址登录次数
export function addressNonce(address: string) {
  return Service({
    url: `/address/nonce/${address}`,
    method: 'get'
  })
}
// 登录
export function login(data: { address: string, sign: string }) {
  return Service(<configData>{
    url: '/address/login',
    method: 'post',
    loading: false,
    data
  })
}
// 设置父级地址
export function isLoopInviter(inviter: string) {
  return Service(<configData>{
    url: `/addressRel/${inviter}`,
    loading: false,
    method: 'post'
  })
}
// 查询股东
export function addressSelf() {
  return Service(<configData>{
    url: `/address/self`,
    loading: false,
    method: 'get'
  })
}
// 我的团队
export function addressRelTeam() {
  return Service(<configData>{
    url: `/addressRel/team`,
    loading: false,
    method: 'get'
  })
}
// 分红
export function access() {
  return Service(<configData>{
    url: `/access`,
    loading: false,
    method: 'get'
  })
}
export function claim(token: string) {
  return Service(<configData>{
    url: `/claim/${token}`,
    loading: true,
    method: 'post'
  })
}
export function claimPage(data: { page: number }) {
  return Service(<configData>{
    url: `/claim/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function childPage(data: { page: number }) {
  return Service(<configData>{
    url: `/ido/child`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function allNetInfo(data: { page: number }) {
  return Service(<configData>{
    url: `/access/level1/rate`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function levelLotteryPool() {
  return Service(<configData>{
    url: `/conf/levelLotteryPool`,
    loading: false,
    method: 'get'
  })
}
// 抽奖
export function userLottery() {
  return Service(<configData>{
    url: `/address/lottery`,
    loading: true,
    method: 'post'
  })
}
// 已获奖领取
export function userClaimLottery() {
  return Service(<configData>{
    url: `/claim/lottery`,
    loading: false,
    method: 'post'
  })
}
// 分红记录
export function levelRewardRecord(data: { page: number }) {
  return Service(<configData>{
    url: `/levelRewardRecord/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
// 团队详情
export function userLevelTeam() {
  return Service(<configData>{
    url: `/address/levelTeam`,
    loading: false,
    method: 'get'
  })
}


// 资产
export function stakeReport() {
  return Service(<configData>{
    url: `/stakeInfo/stakeReport`,
    loading: false,
    method: 'get'
  })
}
//资产余额
export function accessSelf() {
  return Service(<configData>{
    url: `/access/self`,
    loading: false,
    method: 'get'
  })
}
// 资产转让
// private String toAddress;
// private BigDecimal amount;
// private Integer type; 1nft 0frm
export function accessTransfer(data: { toAddress: string, amount: number, type: number }) {
  return Service(<configData>{
    url: `/access/transfer`,
    loading: false,
    data,
    method: 'post'
  })
}
// 提现
export function claimFrm() {
  return Service(<configData>{
    url: `/claim/frm`,
    loading: false,
    method: 'post'
  })
}
export function claimNft() {
  return Service(<configData>{
    url: `/claim/nft`,
    loading: false,
    method: 'post'
  })
}
export function rewardRecordPage(data: { page: number }) {
  return Service(<configData>{
    url: `/rewardRecord/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function lotteryLast() {
  return Service(<configData>{
    url: `/lottery/last`,
    loading: false,
    method: 'get'
  })
}
export function lottery() {
  return Service(<configData>{
    url: `/lottery`,
    loading: false,
    method: 'post'
  })
}
export function lotteryRecordPage(data: { page: number }) {
  return Service(<configData>{
    url: `/lotteryRecord/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function addressIndex() {
  return Service(<configData>{
    url: `/address/index`,
    loading: false,
    method: 'get'
  })
}
export function stakeInfoPage(data: { page: number }) {
  return Service(<configData>{
    url: `/stakeInfo/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function dynamicPowerPage(data: { page: number }) {
  return Service(<configData>{
    url: `/dynamicPower/page`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function addressChildren(data: { page: number }) {
  return Service(<configData>{
    url: `/address/children`,
    loading: false,
    method: 'get',
    params: data
  })
}
export function confVote() {
  return Service(<configData>{
    url: `/conf/vote`,
    loading: false,
    method: 'get'
  })
}
export function vote() {
  return Service(<configData>{
    url: `/vote`,
    loading: false,
    method: 'get'
  })
}
export function voteTypes(type: number | string) {
  return Service(<configData>{
    url: `/vote/${type}`,
    loading: false,
    method: 'post'
  })
}
//算力奖励
export function starPower() {
  return Service(<configData>{
    url: `/address/starPower`,
    loading: false,
    method: 'get'
  })
}